package day15.day15_2.stringb;

import org.junit.Test;

/**
 * @Auther:小陈的Java
 */
public class Demo {
    @Test
    public void test1(){
        StringBuffer stb = new StringBuffer();
    }
    @Test
    public void test2(){
        StringBuffer stb = new StringBuffer();
        String s= stb.append(1).append(true).append("我").toString();
        System.out.println(s);//1true我
        System.out.println(stb);//1true我
        StringBuffer stb2 = new StringBuffer("woainizhongguo");
        System.out.println(stb2.delete(3,5));//woaizhongguo
        System.out.println(stb2.replace(3,5,"da"));//woadahongguo
        StringBuffer stb3 = new StringBuffer("abcd");
        System.out.println(stb3.insert(2,"x"));//abxcd
        System.out.println(stb3.reverse());//dcxba
        System.out.println(stb2.indexOf("i"));//-1
        System.out.println(stb2.substring(1));//oadahongguo
        System.out.println(stb3.length());//5
        System.out.println(stb3.charAt(0));//d
        stb3.setCharAt(0,'W');
        System.out.println(stb3);//Wcxba
    }
}
